home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Pascal Super Library
/
Pascal Super Library (CW International)(1997).bin
/
LIBRARY
/
PASCALL
/
NEETVGA
/
RGB
/
FERN0.PAS
next >
Wrap
Pascal/Delphi Source File
|
1993-02-12
|
3KB
|
131 lines
{*****************************************************************************}
{***** <<<Copywright by the gods of the computer>>> ******}
{***** Fernando Padilla ******}
{***** Steve Markham ******}
{***** Idea and original code by: Roger Yarrow ******}
{*****************************************************************************}
uses
crt,graph;
type
RGB=(R,RG,G,GB,B,BW,W);
Var
i,j:Integer;
z:Array[1..768] Of Byte;
c:RGB;
s:Boolean;
procedure setupgraph(Gd,Gm:integer);
begin
InitGraph(Gd,Gm,'c:\tp\bgi');
if GraphResult<>grOk then halt;
cleardevice;
end;
procedure putouttextcenterof(xs,ys:integer; temp:string);
procedure cleartextarea(xs,ys:integer; temp:string);
var
txh,txw:integer;
begin
txh:=textheight(temp); txw:=textwidth(temp);
setcolor(0);
bar(xs-(txw div 2),ys-(txh div 2),xs+(txw div 2)-1,ys+(txh div 2)-1);
setcolor(1);
end;
begin
settextjustify(centertext,centertext);
cleartextarea(xs,ys,temp);
setcolor(2);
outtextxy(xs,ys,temp);
settextjustify(lefttext,lefttext);
end;
Procedure Store;
Begin
i := 0;
j := 1;
For i := 0 To 255 Do
Begin
Port[$3C7] := i;
z[j] := Port[$3C9]; Inc(j);
z[j] := Port[$3C9]; Inc(j);
z[j] := Port[$3C9]; Inc(j);
End;
End;
Procedure SetColor(a,b,c,d : Integer);
procedure displayrgb(a,b,c,d:integer);
var
temp7,temp9r,temp9g,temp9b:string;
begin
str(a,temp7);
str(b,temp9r);
str(c,temp9g);
str(d,temp9b);
putouttextcenterof(getmaxx div 2,100,concat('Color: ',temp7));
putouttextcenterof((getmaxx div 2)-50,120,temp9r);
putouttextcenterof((getmaxx div 2)-50,140,'RED');
putouttextcenterof(getmaxx div 2,120,temp9g);
putouttextcenterof(getmaxx div 2,140,'GREEN');
putouttextcenterof((getmaxx div 2)+50,120,temp9b);
putouttextcenterof((getmaxx div 2)+50,140,'BLUE');
delay(10);
end;
Begin
Port[$3C8] := a;
Port[$3C9] := b;
Port[$3C9] := c;
Port[$3C9] := d;
Displayrgb(a,b,c,d);
End;
Procedure Restore;
Begin
i := 0;
j := 1;
For i := 0 To 1 Do
Begin
SetColor(i,z[j],z[j+1],z[j+2]);
Inc(j,3);
End;
End;
Procedure FadeColor(c : RGB);
Const
base=0;
Top=63;
Procedure DoColor(c : RGB);
Begin
if s then exit;
Case c of
R: SetColor(0,i,0,0);
RG:SetColor(0,i,i,0);
G: SetColor(0,0,i,0);
GB:SetColor(0,0,i,i);
B: SetColor(0,0,0,i);
BW:SetColor(0,i div 2,i div 2,i);
W: SetColor(0,i,i,i);
end;
s:=keypressed;
end;
Begin
if s then exit;
For i := base To top Do Docolor(c);
For i := top DownTo base Do Docolor(c);
end;
Begin
Randomize;
setupgraph(ega,egahi);
setbkcolor(0);
store;
s:=false;
Repeat
for c:=R to W do
FadeColor(c);
Until KeyPressed or s;
Restore;
End.